package com.cssy.yd.logic.service.impl;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.byd.acegiext.domain.User;
import com.cssy.yd.logic.dao.LogicPoQuoteItemDAO;
import com.cssy.yd.logic.entity.LogicPoQuoteDO;
import com.cssy.yd.logic.entity.LogicPoQuoteItemDO;
import com.cssy.yd.logic.service.ILogicPoQuoteItemService;
import com.plat.exception.SyBaseException;
import com.plat.helper.SearchConditions;
import com.plat.helper.SearchResult;
import com.plat.util.IDCodeTypeUtil;

@Service("poQuoteItemService")
public class LogicPoQuoteItemServiceImpl implements ILogicPoQuoteItemService {

	@Resource(name="logicPoQuoteItemDAO")
	private LogicPoQuoteItemDAO logicPoQuoteItemDAO;
	
	@Override
	public SearchResult findListByExample(SearchConditions scs)
			throws SyBaseException {
		SearchResult rs = new SearchResult(scs);
		List<LogicPoQuoteItemDO> list = logicPoQuoteItemDAO.find(scs);
		rs.setRecordCount(logicPoQuoteItemDAO.count(scs));
		rs.setResults(list);
		return rs;
	}

	@Override
	public Integer delete(String id, User user) throws SyBaseException {
		
		return logicPoQuoteItemDAO.deleteLogicPoQuoteItemDOByPrimaryKey(id);
	}

	@Override
	public Integer update(LogicPoQuoteItemDO t, User user)
			throws SyBaseException {
		t.setDuuser(user.getName());
		t.setDutime(new Date());
		return logicPoQuoteItemDAO.updateLogicPoQuoteItemDO(t);
	}

	@Override
	public LogicPoQuoteItemDO save(LogicPoQuoteItemDO t, User user)
			throws SyBaseException {
		t.setDctime(new Date());
		t.setId(IDCodeTypeUtil.getId());
		logicPoQuoteItemDAO.insertLogicPoQuoteItemDO(t);
		return t;
	}

	@Override
	public LogicPoQuoteItemDO findListById(String id) throws SyBaseException {
		// TODO Auto-generated method stub
		return logicPoQuoteItemDAO.findLogicPoQuoteItemDOByPrimaryKey(id);
	}

	@Override
	public Integer deleteBizRemoved(String id) throws SyBaseException {
		// TODO Auto-generated method stub
		return null;
	}

}
